package org.apache.commons.httpclient.auth;

import org.apache.commons.httpclient.util.LangUtils;

public class AuthScope
{
  public static final AuthScope ANY;
  public static final String ANY_HOST = null;
  public static final int ANY_PORT = -1;
  public static final String ANY_REALM = null;
  public static final String ANY_SCHEME = null;
  private String host;
  private int port;
  private String realm;
  private String scheme;

  static
  {
    ANY = new AuthScope(ANY_HOST, -1, ANY_REALM, ANY_SCHEME);
  }

  public AuthScope(String paramString, int paramInt)
  {
    this(paramString, paramInt, ANY_REALM, ANY_SCHEME);
  }

  public AuthScope(String paramString1, int paramInt, String paramString2)
  {
    this(paramString1, paramInt, paramString2, ANY_SCHEME);
  }

  public AuthScope(String paramString1, int paramInt, String paramString2, String paramString3)
  {
    this.scheme = null;
    this.realm = null;
    this.host = null;
    this.port = -1;
    String str1;
    label34: int i;
    label48: String str2;
    if (paramString1 == null)
    {
      str1 = ANY_HOST;
      this.host = str1;
      if (paramInt >= 0)
        break label95;
      i = -1;
      this.port = i;
      if (paramString2 != null)
        break label101;
      str2 = ANY_REALM;
      label63: this.realm = str2;
      if (paramString3 != null)
        break label107;
    }
    for (String str3 = ANY_SCHEME; ; str3 = paramString3.toUpperCase())
    {
      this.scheme = str3;
      return;
      str1 = paramString1.toLowerCase();
      break label34:
      label95: i = paramInt;
      break label48:
      label101: str2 = paramString2;
      label107: break label63:
    }
  }

  public AuthScope(AuthScope paramAuthScope)
  {
    this.scheme = null;
    this.realm = null;
    this.host = null;
    this.port = -1;
    if (paramAuthScope == null)
      throw new IllegalArgumentException("Scope may not be null");
    this.host = paramAuthScope.getHost();
    this.port = paramAuthScope.getPort();
    this.realm = paramAuthScope.getRealm();
    this.scheme = paramAuthScope.getScheme();
  }

  private static boolean paramsEqual(int paramInt1, int paramInt2)
  {
    if (paramInt1 == paramInt2);
    for (int i = 1; ; i = 0)
      return i;
  }

  private static boolean paramsEqual(String paramString1, String paramString2)
  {
    if (paramString1 == null)
      if (paramString1 != paramString2);
    for (boolean bool = true; ; bool = paramString1.equals(paramString2))
      while (true)
      {
        return bool;
        bool = false;
      }
  }

  public boolean equals(Object paramObject)
  {
    if (paramObject == null);
    for (boolean bool = false; ; bool = false)
      while (true)
      {
        return bool;
        if (paramObject == this)
          bool = true;
        if (!(paramObject instanceof AuthScope))
          bool = super.equals(paramObject);
        AuthScope localAuthScope = (AuthScope)paramObject;
        if ((!(paramsEqual(this.host, localAuthScope.host))) || (!(paramsEqual(this.port, localAuthScope.port))) || (!(paramsEqual(this.realm, localAuthScope.realm))) || (!(paramsEqual(this.scheme, localAuthScope.scheme))))
          break;
        bool = true;
      }
  }

  public String getHost()
  {
    return this.host;
  }

  public int getPort()
  {
    return this.port;
  }

  public String getRealm()
  {
    return this.realm;
  }

  public String getScheme()
  {
    return this.scheme;
  }

  public int hashCode()
  {
    return LangUtils.hashCode(LangUtils.hashCode(LangUtils.hashCode(LangUtils.hashCode(17, this.host), this.port), this.realm), this.scheme);
  }

  public int match(AuthScope paramAuthScope)
  {
    int i = 0;
    if (paramsEqual(this.scheme, paramAuthScope.scheme))
    {
      i = 0 + 1;
      if (!(paramsEqual(this.realm, paramAuthScope.realm)))
        break label101;
      i += 2;
      if (!(paramsEqual(this.port, paramAuthScope.port)))
        break label127;
      i += 4;
      if (!(paramsEqual(this.host, paramAuthScope.host)))
        break label151;
      i += 8;
    }
    for (int j = i; ; j = -1)
    {
      while (true)
      {
        return j;
        if ((this.scheme != ANY_SCHEME) && (paramAuthScope.scheme != ANY_SCHEME));
        j = -1;
        continue;
        label101: if ((this.realm != ANY_REALM) && (paramAuthScope.realm != ANY_REALM));
        j = -1;
        continue;
        label127: if ((this.port != -1) && (paramAuthScope.port != -1));
        j = -1;
      }
      label151: if ((this.host == ANY_HOST) || (paramAuthScope.host == ANY_HOST));
    }
  }

  public String toString()
  {
    StringBuffer localStringBuffer = new StringBuffer();
    if (this.scheme != null)
    {
      localStringBuffer.append(this.scheme.toUpperCase());
      localStringBuffer.append(' ');
    }
    if (this.realm != null)
    {
      localStringBuffer.append('\'');
      localStringBuffer.append(this.realm);
      localStringBuffer.append('\'');
    }
    while (true)
    {
      if (this.host != null)
      {
        localStringBuffer.append('@');
        localStringBuffer.append(this.host);
        if (this.port >= 0)
        {
          localStringBuffer.append(':');
          localStringBuffer.append(this.port);
        }
      }
      return localStringBuffer.toString();
      localStringBuffer.append("<any realm>");
    }
  }
}

/* Location:           E:\Desktop\Android\wordstd\classes_dex2jar.jar
 * Qualified Name:     org.apache.commons.httpclient.auth.AuthScope
 * JD-Core Version:    0.5.3
 */